package com.bleeth.fx.font;

import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.util.RandomUtil;
import javafx.scene.text.Font;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @author Sakura
 * @version 1.0
 * @date 2021-11-16 20:58
 **/
public class IconFontLoader {

    public static Font font;
    public static Map<String, Character> iconMap = new HashMap<>();

    static {
        font = Font.loadFont(ResourceUtil.getStream("font/element-icons.ttf"), 10);
    }



    static {
        iconMap.put("icon-ice-cream-round",'\uE6a0');
        iconMap.put("icon-ice-cream-square",'\uE6a3');
        iconMap.put("icon-lollipop",'\uE6a4');
        iconMap.put("icon-potato-strips",'\uE6a5');
        iconMap.put("icon-milk-tea",'\uE6a6');
        iconMap.put("icon-ice-drink",'\uE6a7');
        iconMap.put("icon-ice-tea",'\uE6a9');
        iconMap.put("icon-coffee",'\uE6aa');
        iconMap.put("icon-orange",'\uE6ab');
        iconMap.put("icon-pear",'\uE6ac');
        iconMap.put("icon-apple",'\uE6ad');
        iconMap.put("icon-cherry",'\uE6ae');
        iconMap.put("icon-watermelon",'\uE6af');
        iconMap.put("icon-grape",'\uE6b0');
        iconMap.put("icon-refrigerator",'\uE6b1');
        iconMap.put("icon-goblet-square-full",'\uE6b2');
        iconMap.put("icon-goblet-square",'\uE6b3');
        iconMap.put("icon-goblet-full",'\uE6b4');
        iconMap.put("icon-goblet",'\uE6b5');
        iconMap.put("icon-cold-drink",'\uE6b6');
        iconMap.put("icon-coffee-cup",'\uE6b8');
        iconMap.put("icon-water-cup",'\uE6b9');
        iconMap.put("icon-hot-water",'\uE6ba');
        iconMap.put("icon-ice-cream",'\uE6bb');
        iconMap.put("icon-dessert",'\uE6bc');
        iconMap.put("icon-sugar",'\uE6bd');
        iconMap.put("icon-tableware",'\uE6be');
        iconMap.put("icon-burger",'\uE6bf');
        iconMap.put("icon-knife-fork",'\uE6c1');
        iconMap.put("icon-fork-spoon",'\uE6c2');
        iconMap.put("icon-chicken",'\uE6c3');
        iconMap.put("icon-food",'\uE6c4');
        iconMap.put("icon-dish-1",'\uE6c5');
        iconMap.put("icon-dish",'\uE6c6');
        iconMap.put("icon-moon-night",'\uE6ee');
        iconMap.put("icon-moon",'\uE6f0');
        iconMap.put("icon-cloudy-and-sunny",'\uE6f1');
        iconMap.put("icon-partly-cloudy",'\uE6f2');
        iconMap.put("icon-cloudy",'\uE6f3');
        iconMap.put("icon-sunny",'\uE6f6');
        iconMap.put("icon-sunset",'\uE6f7');
        iconMap.put("icon-sunrise-1",'\uE6f8');
        iconMap.put("icon-sunrise",'\uE6f9');
        iconMap.put("icon-heavy-rain",'\uE6fa');
        iconMap.put("icon-lightning",'\uE6fb');
        iconMap.put("icon-light-rain",'\uE6fc');
        iconMap.put("icon-wind-power",'\uE6fd');
        iconMap.put("icon-baseball",'\uE712');
        iconMap.put("icon-soccer",'\uE713');
        iconMap.put("icon-football",'\uE715');
        iconMap.put("icon-basketball",'\uE716');
        iconMap.put("icon-ship",'\uE73f');
        iconMap.put("icon-truck",'\uE740');
        iconMap.put("icon-bicycle",'\uE741');
        iconMap.put("icon-mobile-phone",'\uE6d3');
        iconMap.put("icon-service",'\uE6d4');
        iconMap.put("icon-key",'\uE6e2');
        iconMap.put("icon-unlock",'\uE6e4');
        iconMap.put("icon-lock",'\uE6e5');
        iconMap.put("icon-watch",'\uE6fe');
        iconMap.put("icon-watch-1",'\uE6ff');
        iconMap.put("icon-timer",'\uE702');
        iconMap.put("icon-alarm-clock",'\uE703');
        iconMap.put("icon-map-location",'\uE704');
        iconMap.put("icon-delete-location",'\uE705');
        iconMap.put("icon-add-location",'\uE706');
        iconMap.put("icon-location-information",'\uE707');
        iconMap.put("icon-location-outline",'\uE708');
        iconMap.put("icon-location",'\uE79e');
        iconMap.put("icon-place",'\uE709');
        iconMap.put("icon-discover",'\uE70a');
        iconMap.put("icon-first-aid-kit",'\uE70b');
        iconMap.put("icon-trophy-1",'\uE70c');
        iconMap.put("icon-trophy",'\uE70d');
        iconMap.put("icon-medal",'\uE70e');
        iconMap.put("icon-medal-1",'\uE70f');
        iconMap.put("icon-stopwatch",'\uE710');
        iconMap.put("icon-mic",'\uE711');
        iconMap.put("icon-copy-document",'\uE718');
        iconMap.put("icon-full-screen",'\uE719');
        iconMap.put("icon-switch-button",'\uE71b');
        iconMap.put("icon-aim",'\uE71c');
        iconMap.put("icon-crop",'\uE71d');
        iconMap.put("icon-odometer",'\uE71e');
        iconMap.put("icon-time",'\uE71f');
        iconMap.put("icon-bangzhu",'\uE724');
        iconMap.put("icon-close-notification",'\uE726');
        iconMap.put("icon-microphone",'\uE727');
        iconMap.put("icon-turn-off-microphone",'\uE728');
        iconMap.put("icon-position",'\uE729');
        iconMap.put("icon-postcard",'\uE72a');
        iconMap.put("icon-message",'\uE72b');
        iconMap.put("icon-chat-line-square",'\uE72d');
        iconMap.put("icon-chat-dot-square",'\uE72e');
        iconMap.put("icon-chat-dot-round",'\uE72f');
        iconMap.put("icon-chat-square",'\uE730');
        iconMap.put("icon-chat-line-round",'\uE731');
        iconMap.put("icon-chat-round",'\uE732');
        iconMap.put("icon-set-up",'\uE733');
        iconMap.put("icon-turn-off",'\uE734');
        iconMap.put("icon-open",'\uE735');
        iconMap.put("icon-connection",'\uE736');
        iconMap.put("icon-link",'\uE737');
        iconMap.put("icon-cpu",'\uE738');
        iconMap.put("icon-thumb",'\uE739');
        iconMap.put("icon-female",'\uE73a');
        iconMap.put("icon-male",'\uE73b');
        iconMap.put("icon-guide",'\uE73c');
        iconMap.put("icon-news",'\uE73e');
        iconMap.put("icon-price-tag",'\uE744');
        iconMap.put("icon-discount",'\uE745');
        iconMap.put("icon-wallet",'\uE747');
        iconMap.put("icon-coin",'\uE748');
        iconMap.put("icon-money",'\uE749');
        iconMap.put("icon-bank-card",'\uE74a');
        iconMap.put("icon-box",'\uE74b');
        iconMap.put("icon-present",'\uE74c');
        iconMap.put("icon-sell",'\uE6d5');
        iconMap.put("icon-sold-out",'\uE6d6');
        iconMap.put("icon-shopping-bag-2",'\uE74d');
        iconMap.put("icon-shopping-bag-1",'\uE74e');
        iconMap.put("icon-shopping-cart-2",'\uE74f');
        iconMap.put("icon-shopping-cart-1",'\uE750');
        iconMap.put("icon-shopping-cart-full",'\uE751');
        iconMap.put("icon-smoking",'\uE752');
        iconMap.put("icon-no-smoking",'\uE753');
        iconMap.put("icon-house",'\uE754');
        iconMap.put("icon-table-lamp",'\uE755');
        iconMap.put("icon-school",'\uE756');
        iconMap.put("icon-office-building",'\uE757');
        iconMap.put("icon-toilet-paper",'\uE758');
        iconMap.put("icon-notebook-2",'\uE759');
        iconMap.put("icon-notebook-1",'\uE75a');
        iconMap.put("icon-files",'\uE75b');
        iconMap.put("icon-collection",'\uE75c');
        iconMap.put("icon-receiving",'\uE75d');
        iconMap.put("icon-suitcase-1",'\uE760');
        iconMap.put("icon-suitcase",'\uE761');
        iconMap.put("icon-film",'\uE763');
        iconMap.put("icon-collection-tag",'\uE765');
        iconMap.put("icon-data-analysis",'\uE766');
        iconMap.put("icon-pie-chart",'\uE767');
        iconMap.put("icon-data-board",'\uE768');
        iconMap.put("icon-data-line",'\uE76d');
        iconMap.put("icon-reading",'\uE769');
        iconMap.put("icon-magic-stick",'\uE76a');
        iconMap.put("icon-coordinate",'\uE76b');
        iconMap.put("icon-mouse",'\uE76c');
        iconMap.put("icon-brush",'\uE76e');
        iconMap.put("icon-headset",'\uE76f');
        iconMap.put("icon-umbrella",'\uE770');
        iconMap.put("icon-scissors",'\uE771');
        iconMap.put("icon-mobile",'\uE773');
        iconMap.put("icon-attract",'\uE774');
        iconMap.put("icon-monitor",'\uE775');
        iconMap.put("icon-search",'\uE778');
        iconMap.put("icon-takeaway-box",'\uE77a');
        iconMap.put("icon-paperclip",'\uE77d');
        iconMap.put("icon-printer",'\uE77e');
        iconMap.put("icon-document-add",'\uE782');
        iconMap.put("icon-document",'\uE785');
        iconMap.put("icon-document-checked",'\uE786');
        iconMap.put("icon-document-copy",'\uE787');
        iconMap.put("icon-document-delete",'\uE788');
        iconMap.put("icon-document-remove",'\uE789');
        iconMap.put("icon-tickets",'\uE78b');
        iconMap.put("icon-folder-checked",'\uE77f');
        iconMap.put("icon-folder-delete",'\uE780');
        iconMap.put("icon-folder-remove",'\uE781');
        iconMap.put("icon-folder-add",'\uE783');
        iconMap.put("icon-folder-opened",'\uE784');
        iconMap.put("icon-folder",'\uE78a');
        iconMap.put("icon-edit-outline",'\uE764');
        iconMap.put("icon-edit",'\uE78c');
        iconMap.put("icon-date",'\uE78e');
        iconMap.put("icon-c-scale-to-original",'\uE7c6');
        iconMap.put("icon-view",'\uE6ce');
        iconMap.put("icon-loading",'\uE6cf');
        iconMap.put("icon-rank",'\uE6d1');
        iconMap.put("icon-sort-down",'\uE7c4');
        iconMap.put("icon-sort-up",'\uE7c5');
        iconMap.put("icon-sort",'\uE6d2');
        iconMap.put("icon-finished",'\uE6cd');
        iconMap.put("icon-refresh-left",'\uE6c7');
        iconMap.put("icon-refresh-right",'\uE6c8');
        iconMap.put("icon-refresh",'\uE6d0');
        iconMap.put("icon-video-play",'\uE7c0');
        iconMap.put("icon-video-pause",'\uE7c1');
        iconMap.put("icon-d-arrow-right",'\uE6dc');
        iconMap.put("icon-d-arrow-left",'\uE6dd');
        iconMap.put("icon-arrow-up",'\uE6e1');
        iconMap.put("icon-arrow-down",'\uE6df');
        iconMap.put("icon-arrow-right",'\uE6e0');
        iconMap.put("icon-arrow-left",'\uE6de');
        iconMap.put("icon-top-right",'\uE6e7');
        iconMap.put("icon-top-left",'\uE6e8');
        iconMap.put("icon-top",'\uE6e6');
        iconMap.put("icon-bottom",'\uE6eb');
        iconMap.put("icon-right",'\uE6e9');
        iconMap.put("icon-back",'\uE6ea');
        iconMap.put("icon-bottom-right",'\uE6ec');
        iconMap.put("icon-bottom-left",'\uE6ed');
        iconMap.put("icon-caret-top",'\uE78f');
        iconMap.put("icon-caret-bottom",'\uE790');
        iconMap.put("icon-caret-right",'\uE791');
        iconMap.put("icon-caret-left",'\uE792');
        iconMap.put("icon-d-caret",'\uE79a');
        iconMap.put("icon-share",'\uE793');
        iconMap.put("icon-menu",'\uE798');
        iconMap.put("icon-s-grid",'\uE7a6');
        iconMap.put("icon-s-check",'\uE7a7');
        iconMap.put("icon-s-data",'\uE7a8');
        iconMap.put("icon-s-opportunity",'\uE7aa');
        iconMap.put("icon-s-custom",'\uE7ab');
        iconMap.put("icon-s-claim",'\uE7ad');
        iconMap.put("icon-s-finance",'\uE7ae');
        iconMap.put("icon-s-comment",'\uE7af');
        iconMap.put("icon-s-flag",'\uE7b0');
        iconMap.put("icon-s-marketing",'\uE7b1');
        iconMap.put("icon-s-shop",'\uE7b4');
        iconMap.put("icon-s-open",'\uE7b5');
        iconMap.put("icon-s-management",'\uE7b6');
        iconMap.put("icon-s-ticket",'\uE7b7');
        iconMap.put("icon-s-release",'\uE7b8');
        iconMap.put("icon-s-home",'\uE7b9');
        iconMap.put("icon-s-promotion",'\uE7ba');
        iconMap.put("icon-s-operation",'\uE7bb');
        iconMap.put("icon-s-unfold",'\uE7bc');
        iconMap.put("icon-s-fold",'\uE7a9');
        iconMap.put("icon-s-platform",'\uE7bd');
        iconMap.put("icon-s-order",'\uE7be');
        iconMap.put("icon-s-cooperation",'\uE7bf');
        iconMap.put("icon-bell",'\uE725');
        iconMap.put("icon-message-solid",'\uE799');
        iconMap.put("icon-video-camera",'\uE772');
        iconMap.put("icon-video-camera-solid",'\uE796');
        iconMap.put("icon-camera",'\uE779');
        iconMap.put("icon-camera-solid",'\uE79b');
        iconMap.put("icon-download",'\uE77c');
        iconMap.put("icon-upload2",'\uE77b');
        iconMap.put("icon-upload",'\uE7c3');
        iconMap.put("icon-picture-outline-round",'\uE75f');
        iconMap.put("icon-picture-outline",'\uE75e');
        iconMap.put("icon-picture",'\uE79f');
        iconMap.put("icon-close",'\uE6db');
        iconMap.put("icon-check",'\uE6da');
        iconMap.put("icon-plus",'\uE6d9');
        iconMap.put("icon-minus",'\uE6d8');
        iconMap.put("icon-help",'\uE73d');
        iconMap.put("icon-s-help",'\uE7b3');
        iconMap.put("icon-circle-close",'\uE78d');
        iconMap.put("icon-circle-check",'\uE720');
        iconMap.put("icon-circle-plus-outline",'\uE723');
        iconMap.put("icon-remove-outline",'\uE722');
        iconMap.put("icon-zoom-out",'\uE776');
        iconMap.put("icon-zoom-in",'\uE777');
        iconMap.put("icon-error",'\uE79d');
        iconMap.put("icon-success",'\uE79c');
        iconMap.put("icon-circle-plus",'\uE7a0');
        iconMap.put("icon-remove",'\uE7a2');
        iconMap.put("icon-info",'\uE7a1');
        iconMap.put("icon-question",'\uE7a4');
        iconMap.put("icon-warning-outline",'\uE6c9');
        iconMap.put("icon-warning",'\uE7a3');
        iconMap.put("icon-goods",'\uE7c2');
        iconMap.put("icon-s-goods",'\uE7b2');
        iconMap.put("icon-star-off",'\uE717');
        iconMap.put("icon-star-on",'\uE797');
        iconMap.put("icon-more-outline",'\uE6cc');
        iconMap.put("icon-more",'\uE794');
        iconMap.put("icon-phone-outline",'\uE6cb');
        iconMap.put("icon-phone",'\uE795');
        iconMap.put("icon-user",'\uE6e3');
        iconMap.put("icon-user-solid",'\uE7a5');
        iconMap.put("icon-setting",'\uE6ca');
        iconMap.put("icon-s-tools",'\uE7ac');
        iconMap.put("icon-delete",'\uE6d7');
        iconMap.put("icon-delete-solid",'\uE7c9');
        iconMap.put("icon-eleme",'\uE7c7');
        iconMap.put("icon-platform-eleme",'\uE7ca');

    }

    public static Character getCode(String code) {
        return iconMap.get(code);
    }

    public static String getRandomKey() {
        int randomInt = RandomUtil.randomInt(0, iconMap.size());
        Set<String> keySet = iconMap.keySet();
        List<String> list = keySet.stream().collect(Collectors.toList());
        String key = list.get(randomInt);
        return key;
    }

}
